﻿
/*
本文件由工具自动生成 请勿手动修改！！！
*/

using System;
using System.Collections.Generic;

namespace ServerBase.Protocol
{
    public static partial class ProtocolExtensions
    {
        public static T GetClass<T>(this byte[] buffer) where T : ProtocolMsgBase, new()
        {
            var result = new T(); 
            result.Unserialize(buffer); 
            return result;
        }
        public static ProtocolMsgBase GetMsgBase(this byte[] buffer)
        {
            if (buffer.Length < 2)
            {
                return new ProtocolMsgBase();
            }
            EProtocolId pid = (EProtocolId)System.BitConverter.ToUInt16(buffer, 0);
            return pid.GetMsgBase(buffer);
        }
        public static ProtocolMsgBase GetMsgBase(this EProtocolId pid, byte[] buffer)
        {
            switch (pid)
            {
                case EProtocolId.C2G_BASE_DEMO: return new C2G_Base_Demo(buffer);
                case EProtocolId.G2C_BASE_DEMO: return new G2C_Base_Demo(buffer);
                case EProtocolId.G2C_BASE_RESULT: return new G2C_Base_Result(buffer);
                case EProtocolId.C2G_BASE_PING: return new C2G_Base_Ping(buffer);
                case EProtocolId.G2C_BASE_PING: return new G2C_Base_Ping(buffer);
                case EProtocolId.C2G_BASE_GAMEVERSION: return new C2G_Base_GameVersion(buffer);
                case EProtocolId.G2C_BASE_GAMEVERSION: return new G2C_Base_GameVersion(buffer);
                case EProtocolId.C2G_BASE_CONFIRM: return new C2G_Base_Confirm(buffer);
                case EProtocolId.G2C_BASE_CONFIRM: return new G2C_Base_Confirm(buffer);
                case EProtocolId.L2C_LOGIN_CONNECT: return new L2C_Login_Connect(buffer);
                case EProtocolId.C2L_LOGIN_NOTICESYSTEM: return new C2L_Login_NoticeSystem(buffer);
                case EProtocolId.L2C_LOGIN_NOTICESYSTEM: return new L2C_Login_NoticeSystem(buffer);
                case EProtocolId.C2L_LOGIN_NOTICEACTIVITY: return new C2L_Login_NoticeActivity(buffer);
                case EProtocolId.L2C_LOGIN_NOTICEACTIVITY: return new L2C_Login_NoticeActivity(buffer);
                case EProtocolId.C2L_LOGIN_USERLOGIN: return new C2L_Login_UserLogin(buffer);
                case EProtocolId.L2C_LOGIN_USERLOGIN: return new L2C_Login_UserLogin(buffer);
                case EProtocolId.C2L_LOGIN_SDKLOGIN: return new C2L_Login_SdkLogin(buffer);
                case EProtocolId.L2C_LOGIN_SDKLOGIN: return new L2C_Login_SdkLogin(buffer);
                case EProtocolId.G2C_LOGIN_CONNECT: return new G2C_Login_Connect(buffer);
                case EProtocolId.C2G_LOGIN_PLAYERLOGIN: return new C2G_Login_PlayerLogin(buffer);
                case EProtocolId.G2C_LOGIN_PLAYERLOGIN: return new G2C_Login_PlayerLogin(buffer);
                case EProtocolId.C2G_LOGIN_PLAYERCREATE: return new C2G_Login_PlayerCreate(buffer);
                case EProtocolId.G2C_LOGIN_PLAYERCREATE: return new G2C_Login_PlayerCreate(buffer);
                case EProtocolId.G2C_LOGIN_REPLACED: return new G2C_Login_Replaced(buffer);
                case EProtocolId.G2C_LOGIN_BAN: return new G2C_Login_Ban(buffer);
                case EProtocolId.C2G_LOGIN_CHECKNAME: return new C2G_Login_CheckName(buffer);
                case EProtocolId.G2C_LOGIN_CHECKNAME: return new G2C_Login_CheckName(buffer);
                case EProtocolId.C2G_LOGIN_PUIDLOGIN: return new C2G_Login_PuidLogin(buffer);
                case EProtocolId.G2C_LOGIN_PUIDLOGIN: return new G2C_Login_PuidLogin(buffer);
                case EProtocolId.G2C_LOGIN_SERVEREXIT: return new G2C_Login_ServerExit(buffer);
                case EProtocolId.C2G_INFO_GETALL: return new C2G_Info_GetAll(buffer);
                case EProtocolId.G2C_INFO_GETALL: return new G2C_Info_GetAll(buffer);
                case EProtocolId.G2C_INFO_PUSHALL: return new G2C_Info_PushAll(buffer);
                case EProtocolId.G2C_INFO_PUSHBASE: return new G2C_Info_PushBase(buffer);
                case EProtocolId.C2G_INFO_CHANGEFLAGCLIENT: return new C2G_Info_ChangeFlagClient(buffer);
                case EProtocolId.G2C_INFO_CHANGEFLAGCLIENT: return new G2C_Info_ChangeFlagClient(buffer);
                case EProtocolId.C2G_INFO_CHANGEFLAGCLIENTDAILY: return new C2G_Info_ChangeFlagClientDaily(buffer);
                case EProtocolId.G2C_INFO_CHANGEFLAGCLIENTDAILY: return new G2C_Info_ChangeFlagClientDaily(buffer);
                case EProtocolId.C2G_INFO_PLAYERFIND: return new C2G_Info_PlayerFind(buffer);
                case EProtocolId.G2C_INFO_PLAYERFIND: return new G2C_Info_PlayerFind(buffer);
                case EProtocolId.C2G_NOTICE_SYSTEM: return new C2G_Notice_System(buffer);
                case EProtocolId.G2C_NOTICE_SYSTEM: return new G2C_Notice_System(buffer);
                case EProtocolId.C2G_NOTICE_ACTIVITY: return new C2G_Notice_Activity(buffer);
                case EProtocolId.G2C_NOTICE_ACTIVITY: return new G2C_Notice_Activity(buffer);
                case EProtocolId.G2C_NOTICE_ROLLING: return new G2C_Notice_Rolling(buffer);
                case EProtocolId.G2C_INFO_PUSHGAMENOTIFY: return new G2C_Info_PushGameNotify(buffer);
                case EProtocolId.C2G_INFO_GETCONFTEXT: return new C2G_Info_GetConfText(buffer);
                case EProtocolId.G2C_INFO_GETCONFTEXT: return new G2C_Info_GetConfText(buffer);
                case EProtocolId.C2G_MAIL_LIST: return new C2G_Mail_List(buffer);
                case EProtocolId.G2C_MAIL_LIST: return new G2C_Mail_List(buffer);
                case EProtocolId.C2G_MAIL_READ: return new C2G_Mail_Read(buffer);
                case EProtocolId.G2C_MAIL_READ: return new G2C_Mail_Read(buffer);
                case EProtocolId.C2G_MAIL_GET: return new C2G_Mail_Get(buffer);
                case EProtocolId.G2C_MAIL_GET: return new G2C_Mail_Get(buffer);
                case EProtocolId.C2G_MAIL_GETALL: return new C2G_Mail_GetAll(buffer);
                case EProtocolId.G2C_MAIL_GETALL: return new G2C_Mail_GetAll(buffer);
                case EProtocolId.C2G_MAIL_DELETE: return new C2G_Mail_Delete(buffer);
                case EProtocolId.G2C_MAIL_DELETE: return new G2C_Mail_Delete(buffer);
                case EProtocolId.C2G_MAIL_DELETEREADED: return new C2G_Mail_DeleteReaded(buffer);
                case EProtocolId.G2C_MAIL_DELETEREADED: return new G2C_Mail_DeleteReaded(buffer);
                case EProtocolId.C2G_MAIL_SAVE: return new C2G_Mail_Save(buffer);
                case EProtocolId.G2C_MAIL_SAVE: return new G2C_Mail_Save(buffer);
                case EProtocolId.C2G_MAIL_SEND: return new C2G_Mail_Send(buffer);
                case EProtocolId.G2C_MAIL_SEND: return new G2C_Mail_Send(buffer);
                case EProtocolId.G2C_GAME_MESSAGE: return new G2C_Game_Message(buffer);
                case EProtocolId.C2G_CHAT_SEND: return new C2G_Chat_Send(buffer);
                case EProtocolId.G2C_CHAT_SEND: return new G2C_Chat_Send(buffer);
                case EProtocolId.G2C_CHAT_RECEIVE: return new G2C_Chat_Receive(buffer);
                case EProtocolId.C2G_ROOM_INFO: return new C2G_Room_Info(buffer);
                case EProtocolId.G2C_ROOM_INFO: return new G2C_Room_Info(buffer);
                case EProtocolId.G2C_ROOM_ROOMTHING: return new G2C_Room_RoomThing(buffer);
                case EProtocolId.C2G_ROOM_FLY: return new C2G_Room_Fly(buffer);
                case EProtocolId.G2C_ROOM_FLY: return new G2C_Room_Fly(buffer);
                case EProtocolId.C2G_ROOM_GO: return new C2G_Room_Go(buffer);
                case EProtocolId.G2C_ROOM_GO: return new G2C_Room_Go(buffer);
                case EProtocolId.C2G_ITEM_GET: return new C2G_Item_Get(buffer);
                case EProtocolId.G2C_ITEM_GET: return new G2C_Item_Get(buffer);
                case EProtocolId.C2G_ITEM_DROP: return new C2G_Item_Drop(buffer);
                case EProtocolId.G2C_ITEM_DROP: return new G2C_Item_Drop(buffer);
                case EProtocolId.C2G_ITEM_USE: return new C2G_Item_Use(buffer);
                case EProtocolId.G2C_ITEM_USE: return new G2C_Item_Use(buffer);
                case EProtocolId.C2G_EQUIP_GET: return new C2G_Equip_Get(buffer);
                case EProtocolId.G2C_EQUIP_GET: return new G2C_Equip_Get(buffer);
                case EProtocolId.C2G_EQUIP_INFOROOM: return new C2G_Equip_InfoRoom(buffer);
                case EProtocolId.G2C_EQUIP_INFOROOM: return new G2C_Equip_InfoRoom(buffer);
                case EProtocolId.C2G_EQUIP_INFOINV: return new C2G_Equip_InfoInv(buffer);
                case EProtocolId.G2C_EQUIP_INFOINV: return new G2C_Equip_InfoInv(buffer);
                case EProtocolId.C2G_EQUIP_DROP: return new C2G_Equip_Drop(buffer);
                case EProtocolId.G2C_EQUIP_DROP: return new G2C_Equip_Drop(buffer);
                case EProtocolId.C2G_EQUIP_WEAR: return new C2G_Equip_Wear(buffer);
                case EProtocolId.G2C_EQUIP_WEAR: return new G2C_Equip_Wear(buffer);
                case EProtocolId.C2G_EQUIP_CHANGE: return new C2G_Equip_Change(buffer);
                case EProtocolId.G2C_EQUIP_CHANGE: return new G2C_Equip_Change(buffer);
                case EProtocolId.C2G_EQUIP_UNWEAR: return new C2G_Equip_Unwear(buffer);
                case EProtocolId.G2C_EQUIP_UNWEAR: return new G2C_Equip_Unwear(buffer);
                case EProtocolId.C2G_NPC_LOOK: return new C2G_Npc_Look(buffer);
                case EProtocolId.G2C_NPC_LOOK: return new G2C_Npc_Look(buffer);
                case EProtocolId.C2G_NPC_KILL: return new C2G_Npc_Kill(buffer);
                case EProtocolId.G2C_NPC_KILL: return new G2C_Npc_Kill(buffer);
                case EProtocolId.C2G_CHAR_SCORE: return new C2G_Char_Score(buffer);
                case EProtocolId.G2C_CHAR_SCORE: return new G2C_Char_Score(buffer);
                case EProtocolId.C2G_CHAR_OFFLINEINFO: return new C2G_Char_OfflineInfo(buffer);
                case EProtocolId.G2C_CHAR_OFFLINEINFO: return new G2C_Char_OfflineInfo(buffer);
                case EProtocolId.C2G_CHAR_OFFLINE: return new C2G_Char_Offline(buffer);
                case EProtocolId.G2C_CHAR_OFFLINE: return new G2C_Char_Offline(buffer);
                case EProtocolId.C2G_CHAR_LOOK: return new C2G_Char_Look(buffer);
                case EProtocolId.G2C_CHAR_LOOK: return new G2C_Char_Look(buffer);
                case EProtocolId.C2G_CHAR_INV: return new C2G_Char_Inv(buffer);
                case EProtocolId.G2C_CHAR_INV: return new G2C_Char_Inv(buffer);
                case EProtocolId.C2G_SKILL_LIST: return new C2G_Skill_List(buffer);
                case EProtocolId.G2C_SKILL_LIST: return new G2C_Skill_List(buffer);
                case EProtocolId.C2G_SKILL_LEVELUP: return new C2G_Skill_Levelup(buffer);
                case EProtocolId.G2C_SKILL_LEVELUP: return new G2C_Skill_Levelup(buffer);
                case EProtocolId.C2G_SKILL_USAGEUSE: return new C2G_Skill_UsageUse(buffer);
                case EProtocolId.G2C_SKILL_USAGEUSE: return new G2C_Skill_UsageUse(buffer);
                case EProtocolId.B2T_GT_START: return new B2T_Gt_Start(buffer);
                case EProtocolId.B2G_GT_ACTION: return new B2G_Gt_Action(buffer);
                case EProtocolId.G2B_GT_ACTION: return new G2B_Gt_Action(buffer);
                case EProtocolId.B2T_GT_END: return new B2T_Gt_End(buffer);

                default: return new ProtocolMsgBase();
            }
        }
    }
}

